#pragma once

class CErrorScreen
{
	static int __stdcall DialogProc(HWND hWindow, UINT uMsg, WPARAM w, LPARAM l);
	bool m_running;
	HWND m_hDialog;
	HWND m_hCrashd;
	HWND m_hContinue;
	HWND m_hSave;
	HWND m_hRichEdit;
public:
	CErrorScreen();
	void ShowDialog();
	bool IsCrashDumpEnabled()
	{
		return SendMessage(m_hCrashd, BM_GETCHECK, 0, 0) != BST_UNCHECKED;
	}
	bool IsContinueEnabled()
	{
		return SendMessage(m_hContinue, BM_GETCHECK, 0, 0) != BST_UNCHECKED;
	}
	bool IsSaveEnabled()
	{
		return SendMessage(m_hSave, BM_GETCHECK, 0, 0) != BST_UNCHECKED;
	}
	void Destroy()
	{
		DestroyWindow(m_hDialog);
	}
	void AppendText(std::string szText);
	void HandleError(ui32 excode, EXCEPTION_POINTERS* ep);
	static ui32 RaiseException(ui32 excode, EXCEPTION_POINTERS* ep, const char* info = "");
};